What is MIME type "text/xml (deprecated)"?

A MIME type is a string that tells browsers and other tools how to handle a particular kind of file.

MIME type text/xml (deprecated) designates XML content that is treated as plain text. This type tells systems that the file uses XML markup for its structure and data.


Historically, this MIME type was common when XML was emerging. It enabled browsers and other applications to display XML as text. However, it lacks robust encoding handling. Newer standards now favor application/xml, which better manages character sets and parsing.



File formats like FRM, XFDL, and XFD relied on this MIME type. These files use the Extensible Forms Description Language to define complex form structures.



Note: Modern systems avoid using text/xml to prevent misinterpretation of encoding. Instead, using application/xml is recommended. For additional details, see W3C XML MIME Types.

Associated file extensions

Usage Examples

HTTP Header

When serving content with this MIME type, set the Content-Type header:


    Content-Type: text/xml (deprecated)    
  

HTML

In HTML, you can specify the MIME type in various elements:


    <a href="file.dat" type="text/xml (deprecated)">Download file</a>    
  

Server-side (Node.js)

Setting the Content-Type header in Node.js:


    const http = require('http');    
    
    http.createServer((req, res) => {    
      res.setHeader('Content-Type', 'text/xml (deprecated)');    
      res.end('Content here');    
    }).listen(3000);    
  

Associated file extensions

FAQs

Why is the MIME type text/xml considered deprecated?

It is deprecated primarily due to character encoding issues. By default, text/* MIME types are treated as US-ASCII, which can override the encoding specified inside the XML declaration (e.g., <?xml version="1.0" encoding="UTF-8"?>). This often leads to corrupted characters in non-English texts.

What is the difference between text/xml and application/xml?

The main difference lies in how encoding is determined. text/xml relies on the HTTP charset parameter (defaulting to ASCII if missing), whereas application/xml allows the XML parser to determine the encoding from the file's own content. RFC 7303 recommends using application/xml for robust data exchange.

How do I configure Apache to serve .xfdl files as text/xml?

To serve legacy XFDL forms with this MIME type, add the following line to your .htaccess or httpd.conf file: AddType text/xml .xfdl. However, verify if your specific application requires a more specific type like application/vnd.xfdl before applying this change.

Which file extensions are associated with text/xml?

Beyond standard .xml files, this MIME type is historically linked to form definitions like .frm, .xfd, and .xfdl. You can learn more about these specific formats at XFDL or FRM.

Should I use text/xml for a new REST API?

No, you should avoid it for new development. Use application/xml if you need XML support, or consider application/json for lighter data payloads. Using text/xml may cause client-side parsing errors if the character encoding is not explicitly handled in the HTTP headers.

How do I set the MIME type for XML in Nginx?

In your nginx.conf file, locate the types block. Ensure you have a line mapping the extension, such as: text/xml xml xfdl;. If you are migrating to the modern standard, you would change this to application/xml xml;.

Do web browsers still support text/xml?

Yes, major browsers like Chrome, Firefox, and Edge still render content served as text/xml using their built-in XML tree viewers. However, they may strictly enforce encoding rules, potentially displaying error messages if the HTTP header encoding contradicts the XML declaration.

General FAQ

What is a MIME type?

A MIME (Multipurpose Internet Mail Extensions) type is a standard that indicates the nature and format of a document, file, or assortment of bytes. MIME types are defined and standardized in IETF's RFC 6838.

MIME types are important because they help browsers and servers understand how to process a file. When a browser receives a file from a server, it uses the MIME type to determine how to display or handle the content, whether it's an image to display, a PDF to open in a viewer, or a video to play.

MIME types consist of a type and a subtype, separated by a slash (e.g., text/html, image/jpeg, application/pdf). Some MIME types also include optional parameters.

How do I find the MIME type for a file?

You can check the file extension or use a file identification tool such as file --mime-type on the command line. Many programming languages also provide libraries to detect MIME types.

Why are multiple MIME types listed for one extension?

Different applications and historical conventions may use alternative MIME identifiers for the same kind of file. Showing them all helps ensure compatibility across systems.